package com.stitech.logmein.api;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.stitech.util.HttpRequestSender;

@SuppressWarnings("serial")
public class STiteqTunnelProxy extends HttpServlet {
	private String URL = "url";
	private String PARAM = "param";

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		PrintWriter writer = resp.getWriter();
		try {
			String url = req.getParameter(URL);
			String param = req.getParameter(PARAM);

			writer.write(HttpRequestSender.sendGetRequest(url, param));
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			writer.close();
		}
	}
}
